package com.demo.util;

/**
 * @description:
 * @className: MonitorUtil
 * @package: com.demo.first
 * @author: dongww@hsyuntai.com
 * @date: 2019/4/3 10:00
 * @copyright: 版权归 HSYUNTAI 所有
 */
public class MonitorUtil {

    private static ThreadLocal<Long> tl = new ThreadLocal<>();

    public static void start() {
        tl.set(System.currentTimeMillis());
    }

    //结束时打印耗时
    public static void finish(String methodName) {
        long finishTime = System.currentTimeMillis();
        System.out.println(methodName + "方法耗时" + (finishTime - tl.get()) + "ms");
    }
}
